-- Define initial variables
local RFirst = 1
local RCount = 1

-- Check if RFirst is set, if not set it to 1
if not RFirst then
    RFirst = 1
else
    RFirst = 2
end

-- Update RCount based on RFirst value
if RFirst == 2 then
    RCount = 1
end

if RFirst == 1 then
    RCount = RCount + 1
end

-- Ensure RCount stays within the range of 1 and 2
if RCount > 2 then
    RCount = 1
end

-- Adjust playback speed based on RCount
if RCount == 1 then
    require 'import'
    import "android.content.*"
    local i = Intent()
    if service.click({
        {"Video player$7",
        "mor*#1$7",
        "pla*$7",
        "1.25x",
        }
    }) then
        return true
    end
elseif RCount == 2 then
    require 'import'
    import "android.content.*"
    local i = Intent()
    if service.click({
        {"Video player$7",
        "mor*#1$7",
        "pla*$7",
        "1.5x",
        }
    }) then
        return true
    end
end